# Contributor: André Klitzing <aklitzing@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=monero
pkgver=0.17.3.2
pkgrel=1
_ver_randomx=ae8e98b681766f31d49ac562dd6974906156e07b
_ver_supercop=633500ad8c8759995049ccd022107d1fa8a1bbc9
pkgdesc="Secure, private, untraceable cryptocurrency"
url="https://getmonero.org/"
arch="all !aarch64 !riscv64" # build failure
license="BSD-3-Clause"
makedepends="
	boost-dev
	cmake
	cppzmq
	hidapi-dev
	libsodium-dev
	miniupnpc-dev
	openpgm-dev
	openssl-dev
	rapidjson-dev
	readline-dev
	unbound-dev
	zeromq-dev
	"
options="!check"
source="$pkgname-$pkgver.tar.gz::https://github.com/monero-project/monero/archive/refs/tags/v$pkgver.tar.gz
	$pkgname-randomx-$_ver_randomx.tar.gz::https://github.com/tevador/RandomX/archive/$_ver_randomx.tar.gz
	$pkgname-supercop-$_ver_supercop.tar.gz::https://github.com/monero-project/supercop/archive/$_ver_supercop.tar.gz
	easylogging.patch
	system-miniupnpc.patch
	version-string.patch
	"

prepare() {
	default_prepare

	rm -fr external/randomx external/supercop
	ln -s $srcdir/RandomX-$_ver_randomx external/randomx
	ln -s $srcdir/supercop-$_ver_supercop external/supercop
}

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DSTACK_TRACE=OFF \
		-DMANUAL_SUBMODULES=1
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
2d34e0525b2ca1d7bddb8ea51776b49fec4fb866a1c1239c347460ed3369af2f430be32da45666f16c369cebef099f285971c0e806d75d60354f195c5f93891d  monero-0.17.3.2.tar.gz
2fec7db22a1364b2dfd2eb181d62b679802c3ba725d06e75406ee0efba3dc6ae7f7cd6387ab2efa70cb26cb22eb64d8bdac007ce73b344ef4ea38ce574dcbd23  monero-randomx-ae8e98b681766f31d49ac562dd6974906156e07b.tar.gz
06cca8d1def31aa11bf5aa42d861c4a027786f7cc494fa3ab53a2bc4bd9d1f55b2389020ba5fd1816ed277b6e4320ad8edbb3117dcf4981fc7fba655c4bbe648  monero-supercop-633500ad8c8759995049ccd022107d1fa8a1bbc9.tar.gz
c149f1e6a6968115f95213d512116457b36665ff1159c5137dda45fa27712ce6f088b908663fb429b8e5f74e41d6cd57669db79d596564ddaca481dbdc63393e  easylogging.patch
53c5d59a8c6a39969ca2507dd0e9cb9339c85f54ae175be4bb773d0a99ca8ba39b4aab3ffe843637395760e1b4162d6002a97242fda3bbfbad1ecccce1ecf209  system-miniupnpc.patch
411d041754bf801a4dcff6eb52d0d7fa29ad07ce673f956764b2d4b8c8252233b5f09f8833f8461be0f9b0c922748db71fecad04ae755c61ebe50113e2648485  version-string.patch
"
